/*
 * TOP SECRET Copyright 2006-2015 Transsion.com All right reserved. This software is the confidential and proprietary
 * information of Transsion.com ("Confidential Information"). You shall not disclose such Confidential Information and
 * shall use it only in accordance with the terms of the license agreement you entered into with Transsion.com.
 */
package com.yunji.framework_template.common.web.exception;

import org.springframework.http.HttpStatus;

/**
 * ClassName:CodeException <br/>
 * Date: 2018年10月16日 下午5:17:31 <br/>
 * 
 * @author fenglibin1982@163.com
 * @Blog http://blog.csdn.net/fenglibing
 * @version
 * @see
 */
public class CodeException extends RuntimeException {

    private static final long serialVersionUID = 4087368163985428379L;
    String                    code;
    String                    desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public CodeException(HttpStatus httpStatus){
        code = String.valueOf(httpStatus.value());
        desc = httpStatus.getReasonPhrase();
    }

    public CodeException(String code){
        this(code, "");
    }

    public CodeException(Integer code){
        this(code, "");
    }

    public CodeException(String code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public CodeException(Integer code, String desc){
        this.code = String.valueOf(code);
        this.desc = desc;
    }
}
